import Vue from 'vue'
import Router from 'vue-router'
import Layout from '../layout/index'

Vue.use(Router)

export const constantRouterMap = [
  { path: '/login',
    meta: { title: '登录', noCache: true },
    component: (resolve) => require(['@/views/login'], resolve),
    hidden: true
  },
  {
    path: '/404',
    component: (resolve) => require(['@/views/features/404'], resolve),
    hidden: true
  },
  {
    path: '/401',
    component: (resolve) => require(['@/views/features/401'], resolve),
    hidden: true
  },
  {
    path: '/redirect',
    component: Layout,
    hidden: true,
    children: [
      {
        path: '/redirect/:path*',
        component: (resolve) => require(['@/views/features/redirect'], resolve)
      }
    ]
  },
  // {
  //   path: '/',
  //   meta: { title: '首页', icon: 'index', affix: true, noCache: true },
  //   component: Layout,
  //   redirect: '/dashboard2',
  //   children: [
  //     {
  //       path: 'dashboard2',
  //       component: (resolve) => require(['@/views/home'], resolve),
  //       name: 'Dashboard',
  //       meta: { title: '首页', icon: 'index', affix: true, noCache: true }
  //     }
  //   ]
  // },
  // {
  //   path: '/club',
  //   meta: { title: '俱乐部管理', icon: 'develop', affix: true, noCache: true },
  //   component: Layout,
  //   redirect: '/club',
  //   children: [
  //     {
  //       path: 'club',
  //       component: (resolve) => require(['@/views/club/index'], resolve),
  //       name: 'club',
  //       meta: { title: '俱乐部管理', icon: 'develop', affix: true, noCache: true }
  //     }
  //   ]
  // },
  // {
  //   path: '/handbook',
  //   meta: { title: '公司手册管理', icon: 'develop', affix: true, noCache: true },
  //   component: Layout,
  //   redirect: '/handbook',
  //   children: [
  //     {
  //       path: 'handbook',
  //       component: (resolve) => require(['@/views/handbook/index'], resolve),
  //       name: 'handbook',
  //       meta: { title: '公司手册管理', icon: 'develop', affix: true, noCache: true }
  //     }
  //   ]
  // },
  // {
  //   path: '/carbonNeutrality',
  //   meta: { title: '双碳文化管理', icon: 'develop', affix: true, noCache: true },
  //   component: Layout,
  //   redirect: '/carbonNeutrality',
  //   children: [
  //     {
  //       path: 'carbonNeutrality',
  //       component: (resolve) => require(['@/views/carbonNeutrality/index'], resolve),
  //       name: 'carbonNeutrality',
  //       meta: { title: '双碳文化管理', icon: 'develop', affix: true, noCache: true }
  //     }
  //   ]
  // },
  // {
  //   path: '/training',
  //   meta: { title: '员工通知管理', icon: 'develop', affix: true, noCache: true },
  //   component: Layout,
  //   redirect: '/training',
  //   children: [
  //     {
  //       path: 'training',
  //       component: (resolve) => require(['@/views/training/index'], resolve),
  //       name: 'training',
  //       meta: { title: '员工通知管理', icon: 'develop', affix: true, noCache: true }
  //     }
  //   ]
  // },
  // {
  //   path: '/workGuide',
  //   meta: { title: '办事指南', icon: 'develop', affix: true, noCache: true },
  //   component: Layout,
  //   redirect: '/workGuide',
  //   children: [
  //     {
  //       path: 'workGuide',
  //       component: (resolve) => require(['@/views/workGuide/index'], resolve),
  //       name: 'training',
  //       meta: { title: '办事指南', icon: 'develop', affix: true, noCache: true }
  //     }
  //   ]
  // },
  // {
  //   path: '/noti',
  //   meta: { title: '通知公告', icon: 'develop', affix: true, noCache: true },
  //   component: Layout,
  //   redirect: '/noti',
  //   children: [
  //     {
  //       path: 'noti',
  //       component: (resolve) => require(['@/views/noti/index'], resolve),
  //       name: 'noti',
  //       meta: { title: '通知公告', icon: 'develop', affix: true, noCache: true }
  //     }
  //   ]
  // },
  // {
  //   path: '/swiper',
  //   meta: { title: '轮播图管理', icon: 'develop', affix: true, noCache: true },
  //   component: Layout,
  //   redirect: '/swiper',
  //   children: [
  //     {
  //       path: 'swiper',
  //       component: (resolve) => require(['@/views/swiper/index'], resolve),
  //       name: 'swiper',
  //       meta: { title: '轮播图管理', icon: 'develop', affix: true, noCache: true }
  //     }
  //   ]
  // },
  {
    path: '/',
    meta: { title: '积分汇总看板', icon: 'develop', affix: true, noCache: true },
    component: Layout,
    redirect: '/home',
    children: [
      {
        path: 'home',
        component: (resolve) => require(['@/views/home/index'], resolve),
        name: 'home',
        meta: { title: '积分汇总看板', icon: 'develop', affix: true, noCache: true }
      },
    ]
  },
  {
    path: '/',
    meta: { title: '新闻动态', icon: 'develop', affix: true, noCache: true },
    component: Layout,
    children: [
      {
        path: 'news',
        component: (resolve) => require(['@/views/news/index'], resolve),
        name: 'news',
        meta: { title: '新闻动态', icon: 'develop', affix: true, noCache: true }
      }
    ]
  },
  // {
  //   path: '/visitorReservation',
  //   meta: { title: '访客管理', icon: 'develop', affix: true, noCache: true },
  //   component: Layout,
  //   redirect: '/visitorReservation',
  //   children: [
  //     {
  //       path: 'visitorReservation',
  //       component: (resolve) => require(['@/views/visitorReservation/index'], resolve),
  //       name: 'visitorReservation',
  //       meta: { title: '访客管理', icon: 'develop', affix: true, noCache: true }
  //     }
  //   ]
  // },
  // {
  //   path: '/jiaRenReport',
  //   meta: { title: '嘉人报道管理', icon: 'develop', affix: true, noCache: true },
  //   component: Layout,
  //   redirect: '/jiaRenReport',
  //   children: [
  //     {
  //       path: 'jiaRenReport',
  //       component: (resolve) => require(['@/views/jiaRenReport/index'], resolve),
  //       name: 'jiaRenReport',
  //       meta: { title: '嘉人报道管理', icon: 'develop', affix: true, noCache: true }
  //     }
  //   ]
  // },
  // {
  //   path: '/jiaYuanStyle',
  //   meta: { title: '嘉园风情管理', icon: 'develop', affix: true, noCache: true },
  //   component: Layout,
  //   redirect: '/jiaYuanStyle',
  //   children: [
  //     {
  //       path: 'jiaYuanStyle',
  //       component: (resolve) => require(['@/views/jiaYuanStyle/index'], resolve),
  //       name: 'jiaYuanStyle',
  //       meta: { title: '嘉园风情管理', icon: 'develop', affix: true, noCache: true }
  //     }
  //   ]
  // },
  // {
  //   path: '/inviteJob',
  //   meta: { title: '招聘管理', icon: 'develop', affix: true, noCache: true },
  //   component: Layout,
  //   redirect: '/inviteJob',
  //   children: [
  //     {
  //       path: 'recruitmentCharter',
  //       component: (resolve) => require(['@/views/inviteJob/recruitmentCharter/index'], resolve),
  //       name: 'recruitmentCharter',
  //       meta: { title: '招聘简章', icon: 'develop', affix: true, noCache: true }
  //     },
  //     {
  //       path: 'internalRecommendation',
  //       component: (resolve) => require(['@/views/inviteJob/internalRecommendation/index'], resolve),
  //       name: 'internalRecommendation',
  //       meta: { title: '内部推荐', icon: 'develop', affix: true, noCache: true }
  //     }
  //   ]
  // },
  // {
  //   path: '/hangjiaxingzheng',
  //   meta: { title: '航嘉行政管理', icon: 'develop', affix: true, noCache: true },
  //   component: Layout,
  //   redirect: '/hangjiaxingzheng',
  //   children: [
  //     {
  //       path: 'hangjiaxingzheng',
  //       component: (resolve) => require(['@/views/hangjiaxingzheng/index'], resolve),
  //       name: 'hangjiaxingzheng',
  //       meta: { title: '航嘉行政', icon: 'develop', affix: true, noCache: true }
  //     }
  //   ]
  // },
  // {
  //   path: '/product',
  //   meta: { title: '商品管理', icon: 'app', affix: true, noCache: true },
  //   component: Layout,
  //   redirect: '/product',
  //   children: [
  //     {
  //       path: 'product',
  //       component: (resolve) => require(['@/views/product/productManage'], resolve),
  //       name: 'Product',
  //       meta: { title: '商品管理', icon: 'app', affix: false, noCache: true }
  //     }
  //   ]
  // },
  {
    path: '/user',
    component: Layout,
    hidden: true,
    redirect: 'noredirect',
    children: [
      {
        path: 'center',
        component: (resolve) => require(['@/views/system/user/center'], resolve),
        name: '个人中心',
        meta: { title: '个人中心' }
      }
    ]
  }
]

export default new Router({
  // mode: 'hash',
  mode: 'history',
  base: 'jialife',
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRouterMap
})
